//
//  test.swift
//  file-server-2.0
//
//  Created by wlx on 17/3/10.
//
//

import Foundation
import Kitura

public func saveImg (name: String, str: String) {
    if let data: NSData = NSData(base64Encoded: str, options: NSData.Base64DecodingOptions.ignoreUnknownCharacters){
        let filePath:String = NSHomeDirectory() + "/Documents/image" + name + ".png"
        let fileManager = FileManager.default
        fileManager.createFile(atPath: filePath, contents: data as Data, attributes: nil)
        print(filePath)
    }
}

